/*
 *  camshift.h
 *  libCV
 *
 *  Created by Gregory Koch on 17/01/11.
 *  Copyright 2011 IFlyBotIV. All rights reserved.
 *
 *  Implementation of the camshift algorithm :
 *  http://fr.wikipedia.org/wiki/Camshift
 *
 */

#ifndef CAMSHIFT_H
#define CAMSHIFT_H

#include "libCV.h"
#include "histogram.h"

#define CAMSHIFT_MAX_IT		15
#define CAMSHIFT_DIST_STOP	0.96
#define SEARCH_ZONE_SCALE   1.2
#define TARGET_SIZE_MIN     10
#define TARGET_SIZE_MAX     200
#define CORREL_TARGET       0.70

typedef struct camshift_target_s
{
	char lock;
	zone_t zone;
	hist_t q;
    cvSize_t img_size;
} camshift_target_t;

/**
 * Returns an initialized camshift_target_t structure
 */
camshift_target_t init_camshift_target();

/**
 * Calibrate the camshift target. 
 * The target will be the image zone gives in the parameters.
 * The image given will be used to follow the target.
 * 
 * Params : 
 */
void calibrate_camshift_target(camshift_target_t *target, image_t img, zone_t zone);

int follow_camshift_target(camshift_target_t *target, image_t img);

#endif
